package org.mspring.platform.security.service;

import java.util.List;

import org.mspring.platform.dao.Page;
import org.mspring.platform.dao.query.QueryBuilder;
import org.mspring.platform.security.dao.ResourceDao;
import org.mspring.platform.security.entity.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author Gao Youbo
 * @since 2013-1-11
 */
@Service
@Transactional
public class ResourceService {

    @Autowired
    private ResourceDao resourceDao;

    public Page<Resource> listPage(QueryBuilder queryBuilder, Page<Resource> page) {
        return resourceDao.listPage(queryBuilder, page);
    }

    public List<Resource> listAll() {
        return resourceDao.listAll();
    }

    public Resource get(long id) {
        return resourceDao.get(id);
    }

    public List<Resource> listByRole(Long roleId) {
        return resourceDao.listByRole(roleId);
    }

    public Long insert(Resource resource) {
        return resourceDao.insert(resource);
    }

    public void update(Resource resource) {
        resourceDao.update(resource);
    }

}
